from pod.std import *
from html.util import tag, css

class Note(Macro):
    name = "note"
    doctype = "html"
    
    def __init__(self, env, scope, color="dddddd"):
        super(Note, self).__init__()
        self.env = env
        self.left = env["doc.width"]
        self.color = color
        css(env, ".note_%s" % color,border="1px solid black",
                        left="%dpx" % self.left,
                        width="150px",
                        position="absolute",
                        float="left",
                        background_color="#%s" % color,
                        padding="5px",
                        margin="15px")
        
        
    def __call__(self, content):
        note = tag("div", klass="note_%s" % self.color)[
            Macro.flatten(content)
        ]
        return str(note)
